<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link type="text/css" rel="stylesheet" href="/css/plugins/fileinput/fileinput.min.css" />
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-goodsInfo-add">
            <div class="form-group">
                <label class="col-sm-3 control-label">商品名称：</label>
                <div class="col-sm-8">
                    <input id="name" name="name" class="form-control" type="text">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">描述：</label>
                <div class="col-sm-8">
                    <input id="goodsDescribe" name="goodsDescribe" class="form-control" type="text">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">图片：</label>
                <div class="col-sm-8">
                    <input id="input-id" name="image" multiple type="file" data-show-caption="true">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">状态：是否上架：</label>
                <div class="col-sm-8">
                    <input id="state" name="state" class="form-control" type="text">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">是否推荐：</label>
                <div class="col-sm-8">
                    <input id="recommend" name="recommend" class="form-control" type="text">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">是否使用定额优惠券：</label>
                <div class="col-sm-8">
                    <input id="useQuotaCoupon" name="useQuotaCoupon" class="form-control" type="text">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">是否使用非定额优惠券：</label>
                <div class="col-sm-8">
                    <input id="useNonQuotaCoupon" name="useNonQuotaCoupon" class="form-control" type="text">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">是否使用积分：</label>
                <div class="col-sm-8">
                    <input id="usePoint" name="usePoint" class="form-control" type="text">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">排序：</label>
                <div class="col-sm-8">
                    <input id="sortNo" name="sortNo" class="form-control" type="text">
                </div>
            </div>  
            <div class="form-group">	
                <label class="col-sm-3 control-label">描述：</label>
                <div class="col-sm-8">
                    <input id="content" name="content" class="form-control" type="text">
                </div>
            </div>  
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button th:onclick="'javascript:layer_close()'" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script th:src="@{/eagledata/business/goodsInfo/add.js}"></script>
	<script type="text/javascript" src="/js/plugins/fileinput/fileinput.min.js"></script>
	<script type="text/javascript" src="/js/plugins/fileinput/locales/zh.js"></script>
	<script>
	 $(function () {
	        initFileInput("input-id");
	    })

	    function initFileInput(ctrlName) {
	        var control = $('#' + ctrlName);
	        control.fileinput({
	            language: 'zh', //设置语言
	            uploadUrl: "upload/insertimg", //上传的地址
	            allowedFileExtensions: ['jpg', 'gif', 'png'],//接收的文件后缀
	            //uploadExtraData:{"id": 1, "fileName":'123.mp3'},
	            uploadAsync: true, //默认异步上传
	            showUpload: true, //是否显示上传按钮
	            showRemove : true, //显示移除按钮
	            showPreview : true, //是否显示预览
	            showCaption: false,//是否显示标题
	            browseClass: "btn btn-primary", //按钮样式
	            //dropZoneEnabled: true,//是否显示拖拽区域
	            //minImageWidth: 50, //图片的最小宽度
	            //minImageHeight: 50,//图片的最小高度
	            //maxImageWidth: 1000,//图片的最大宽度
	            //maxImageHeight: 1000,//图片的最大高度
	            //maxFileSize: 0,//单位为kb，如果为0表示不限制文件大小
	            //minFileCount: 0,
	            //maxFileCount: 10, //表示允许同时上传的最大文件个数
	            enctype: 'multipart/form-data',
	            validateInitialCount:true,
	            previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
	            msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",

	        }).on('filepreupload', function(event, data, previewId, index) {     //上传中
	            var form = data.form, files = data.files, extra = data.extra,
	            response = data.response, reader = data.reader;
	            console.log('文件正在上传');
	        }).on("fileuploaded", function (event, data, previewId, index) {    //一个文件上传成功
	            console.log('文件上传成功！'+data.id);

	        }).on('fileerror', function(event, data, msg) {  //一个文件上传失败
	            console.log('文件上传失败！'+data.id);


	        })
	    }
	</script>
    </body>
</html>